<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<title>修改个人档案</title>
		<link href="themes/css/ui.common.css" rel="stylesheet"
			type="text/css" />
		<link href="themes/css/ui.child.css" rel="stylesheet"
			type="text/css" />
		<link href="themes/css/ui.tips.css" rel="stylesheet"
			type="text/css" />
		<link href="style/jquery_ui/jquery-ui-1.8.custom.css"
			rel="stylesheet" type="text/css" />
		<link id="skin_css" rel="stylesheet" type="text/css"
			href="themes/css/ui.c.blue.css" />
		<link href="style/mailSender.css" rel="stylesheet"
			type="text/css" />
		<link rel="stylesheet" href="themes/css/ui.validation.css" type="text/css"></link>
		<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
		<script src="Scripts/jquery.json-2.2.min.js"
			type="text/javascript"></script>
		<script src="Scripts/jquery-ui-1.8.custom.min.js"
			type="text/javascript"></script>
		<script src="Scripts/ui.default.js " type="text/javascript"
			charset="UTF-8"></script>
		<script src="Scripts/ui.admincp.js" type="text/javascript"
			charset="UTF-8"></script>
		<script src="HtmlEditor/kindeditor.js" type="text/javascript"></script>
		<script src="Scripts/HtmEditorCreator.js" type="text/javascript"></script>
		<script type="text/javascript" src="Scripts/ui.validation.js"></script>
		<style type="text/css">
		.text-align-right {
			text-align: right;
			padding-right: 2px;
			font-weight: bolder;
		}

		.text-control-left {
			text-align: left;
			width: 200px;
		}

		.control-width-180 {
			width: 180px;
		}

		.control-width-80 {
			width: 80px;
		}

		.input-control {
			border: 0;
			height: 24px;
			padding: 2px;
		}

		.td-width-100 {
			text-align: left;
			width: 100px;
		}

		.td-width-100 {
			width: 120px;
		}

		.style1 {
	
		}

		.input-big-text {
			width: 635px;
			height: 100px;
		}

		td {
			padding: 2px;
		}
	</style>
	<script type="text/javascript">
		$(function(){
			$("#dialog").dialog("destroy"); 
			$("#dialog-form").dialog({
			autoOpen: false,
			height: 250,
			width: 450,
			modal: true,
				 
			close: function() {
				//allFields.val('').removeClass('ui-state-error');
			}
			});
			
				$('#modifyPwdButton').click(function() {   
						$("#dialog-form").dialog({'title':"修改登录密码"});
					clearInputControlValue("#dialog-form");
				     $('#dialog-form').dialog('open'); 
				});
			
			setValidate();
		});
 		
 		function setValidate(){
    
    	 $("#form").validatingForm({
        	submitButtonId:"#btnSubmit",
        	  clearErrorsOnFocus:true,
        	 validateOnBlur:true
        	});
        	
         $("#form1").validatingForm({
        	submitButtonId:"#btnSubmit1",
        	  clearErrorsOnFocus:true,
        	 validateOnBlur:true,
        	 success:submit
        	});
    	}
    	
    			function submit(){
    				if($.trim($("#txt_newPwd").val()) != $.trim($("#txt_reNewPwd").val())){
    					alert("警告：两次新密码不一致！");
    					return;
    				}
					var staffPwd = {
					"staffPwd": $.trim($("#txt_pwd").val()),
					"newStaffPwd": $.trim($("#txt_newPwd").val())
					};
				
					var jsonString = $.toJSON(staffPwd);
					$.post(
					"archivesInfo!modifyPwd.action",
					{
						staffPwdJsonString: jsonString
					},
					function(data){
						if(data == "1"){
							alert("提示：修改登录密码成功！请重新登录。");
							top.location.href="login!logout.action";}
						if(data == "0"){
						 	alert("错误：旧密码错误！");
						}
						if(data == "-1"){
							alert("错误：修改登录密码失败！");
						}
					},
					"json"
					);
				}
	</script>
	</head>
	<body>
			<div class="PageChild_Title">
			<img src="themes/images/default/icons/archives.png" class="PageChild_Tbtnpic" />
			<span class="PageChild_separate"></span>
			<span class="PageChild_TbtnText"><h2>修改个人档案</h2></span>
			<span class="PageChild_separate"></span>
			<div id="marker" class="red-tips">
			</div>
			<div class="clear">
			</div>
		</div>
		&nbsp;
		<form id="form" action="archivesInfo!modifyInfoByPerson.action" method="post">
		<table style="border: 1px solid gray; padding: 1px;" border="0"
			cellpadding="0" cellspacing="0" align="center">
			<tr><td colspan="2">&nbsp;</td></tr>
			<tr>
				<td colspan="4" align="center">
					<input type="hidden" name="staffId" value="${staffInfo.staffId}"/>
					<input type="hidden" name="archiveId" value="${staffInfo.archiveInfo.archiveId }"/>
					<input type="hidden" name="mailId" value="${staffInfo.archiveInfo.mailInfo.mailId }" />
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;学号:
				</td>
				<td style="width: 100px" valign="middle" class="style1">
					<input name="staffNo" class="control-width-100 input-control clearable" value="${staffInfo.staffNo}" disabled="disabled">
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;密码:
				</td>
				<td style="width: 200px" valign="middle" class="style1">
					<input name="staffPwd" class="control-width-80 input-control clearable" value="******" disabled="disabled"><input type="button" id="modifyPwdButton" class="o-btn SubmitButton" value="修改密码" />
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;姓名:
				</td>
				<td style="width: 100px" valign="middle" class="style1">
					<input id="staffName" name="staffName" class="control-width-100 required-field input-control clearable" value="${staffInfo.archiveInfo.staffName}">
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;性别:
				</td>
				<td style="width: 100px" class="style1">
					<input name="gender" class="control-width-100 input-control clearable" value="${staffInfo.archiveInfo.gender}" disabled="disabled">
				</td>
			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;年龄:
				</td>
				<td class="style1">
					<input id="age" name="age" max="60" min="16" class="control-width-100 betweenvalue-field required-field input-control clearable" value="${staffInfo.archiveInfo.age}">
				</td>
				<td class="text-align-right">
					&nbsp;生日:
				</td>
				<td class="style1">
					<input name="birthday" class="control-width-100 input-control NeedDate" value="${birthday}" disabled="disabled">
				</td>
			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;政治面貌:
				</td>
				<td class="style1">
					<s:select list="#{'团员':'团员','预备党员':'预备党员','党员':'党员','群众':'群众'}" name="politician" theme="simple" cssClass="control-width-40 clearable" cssStyle="width: 152px; height: 26px"></s:select>
				</td>
				<td class="text-align-right">
					&nbsp;年级:
				</td>
				<td class="style1">
					 <input id="grade" name="grade" class="control-width-100 required-field input-control clearable" value="${staffInfo.archiveInfo.grade}">
				</td>
			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;专业:
				</td>
				<td class="style1">
					<s:select id="marjorList" list="majorList" listKey="majorId" listValue="majorName" headerKey="-1" headerValue="-请选择-" name="majorId" theme="simple" emptyValueMsg="请选择专业。" emptyValueForValidate="-1" cssClass="selectable-field control-width-40 clearable" cssStyle="width: 152px; height: 26px"></s:select>
				</td>
				<td class="text-align-right">
					&nbsp;班级:
				</td>
				<td class="style1">
					<input id="classNo" name="classNo" class="control-width-100 required-field input-control clearable" value="${staffInfo.archiveInfo.classNo}">
				</td>
			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;联系电话:
				</td>
				<td class="style1">
					<input id="telphone" name="telphone" class="control-width-100 telphone-field input-control clearable" value="${staffInfo.archiveInfo.telphone}">
				</td>
				<td class="text-align-right">
					&nbsp;人员邮箱:
				</td>
				<td class="style1">
					<input id="mail" name="mail" class="control-width-100 email-field input-control clearable" value="${staffInfo.archiveInfo.mailInfo.mail}">
				</td>

			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;寝室地址:
				</td>
				<td class="style1">
					<input id="dormitory" name="dormitory" class="control-width-100 required-field input-control clearable" value="${staffInfo.archiveInfo.dormitory}">
				</td>
				<td class="text-align-right">
					&nbsp;档案编号:
				</td>
				<td class="style1">
					<input name="archiveNo" class="control-width-100 input-control clearable" value="${staffInfo.archiveInfo.archiveNo}" disabled="disabled">
				</td>
			</tr>
			<tr>
				<td class="text-align-right">
					&nbsp;所在部门:
				</td>
				<td class="style1">
					<input name="sectionId" class="control-width-100 input-control clearable" value="${staffInfo.archiveInfo.postInfo.sectionInfo.sectionName}" disabled="disabled">
				</td>
				<td class="text-align-right">
					&nbsp;所在职位:
				</td>
				<td class="style1">
                	<input name="postId" class="control-width-100 input-control clearable" value="${staffInfo.archiveInfo.postInfo.postName}" disabled="disabled">
				</td>
			</tr>
			<tr>
				<td colspan="4" align="center">
					&nbsp;
				</td>
			</tr>
			<tr>
				<td colspan="4" align="center">
					<input id="btnSubmit" type="submit" class="ui-button" value="提交" />
				</td>
			</tr>
			<tr>
				<td colspan="4" align="center">
					&nbsp;
				</td>
			</tr>
		</table>
		</form>
	</body>
	<!-- 弹出层标签 -->
	<div id="dialog-form" style="display: none;" title="修改登录密码">
		<div class="ui-mainTab">
			<form id="form1" action="">
			<div>
				<table width="100%" class="tb tb2">
					<tr>
						<td class="mtd">
							&nbsp;原密码:
						</td>
						<td>
							<input class="control required-field clearable" type="password" value=""
								id="txt_pwd">
						</td>
					</tr>
					<tr>
						<td class="mtd">
							&nbsp;新密码:
						</td>
						<td>
							<input class="control required-field clearable" type="password" value=""
								id="txt_newPwd">
						</td>
					</tr>
					<tr>
						<td class="mtd">
							&nbsp;重复新密码:
						</td>
						<td>
							<input class="control required-field clearable" type="password" id="txt_reNewPwd">
						</td>
					</tr>
					<tr>
						<td>
							&nbsp;
						</td>
						<td>
							<div>
								<input id="btnSubmit1" type="button" value="提 交" class="o-btn SubmitButton">
								&nbsp;
								<input type="button" name="name" id="cancelAddGoodsInfoButton"
									class="dialogFormCloseButton o-btn" dialogForm="#dialog-form"
									value="关闭" />
							</div>
						</td>
					</tr>
				</table>
			</div>
			</form>
		</div>
		</div>
		<!-- 弹出层结束 -->
</html>